Skip to content

Conversation

mathieuchopstm
Copy link
Contributor

Ensure the CONFIG_CLOCK_STM32_HSE_CLOCK symbol is not visible when the HSE clock is not enabled.

Depends on #97215.

int "HSE clock value"
default "$(DT_STM32_HSE_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,clk_hse)"
default 8000000
depends on $(dt_nodelabel_enabled,clk_hse)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change would not match the 2 places (2 boards) that set CONFIG_CLOCK_STM32_HSE_CLOCK:
boards/oct/osd32mp1_brk
boards/st/stm32mp157c_dk2
Both do not enable the the clk_hse node.

Note that from what I see, the config is never used. Am I right? Is it still relevant? Maybe to be removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that from what I see, the config is never used. Am I right? Is it still relevant? Maybe to be removed?

My mistake, this config is used by the STM32 HAL.
I think it should be changed to a hidden config and always set from the DT when HSE is enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change would not match the 2 places (2 boards) that set CONFIG_CLOCK_STM32_HSE_CLOCK: boards/oct/osd32mp1_brk boards/st/stm32mp157c_dk2 Both do not enable the the clk_hse node.

Good catch. Clock generators have been omited from MP15 DTSI - presumably because Cortex-A side controls generators but we're running on Cortex-M - but the HAL nonetheless expects this...

Maybe we can special-case MP15 series here? depends on $(dt_nodelabel_enabled,clk_hse) || SOC_SERIES_STM32MP1X + a comment? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can make the option promptless (i.e., can't be used-configured) if HSE exists and visible otherwise.

Maybe this is a less intrusive change. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can special-case MP15 series here (...)

For MP15, it some day it needs HSE, I guess we'll enable the node in the board DT and set the frequency.
Actually, we can already set the frequency rate since HSE oscillator is present but let's enable only if needed.

Or we can make the option promptless (i.e., can't be used-configured) if HSE exists and visible otherwise.

I think it's the best way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I just need to check if it actually works then I'll update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the symbol promptless when clk_hse is enabled and editable otherwise. Updated the MP15 boards to assign a value through configuration files rather than Kconfig symbols.

Ensure the CONFIG_CLOCK_STM32_HSE_CLOCK symbol cannot be overridden when
the value is sourced from Device Tree node "clk_hse" by making it
promptless in this case.

Signed-off-by: Mathieu Choplain <[email protected]>
Set the HSE clock frequency using the board's defconfig file instead of
overriding the definition.

Signed-off-by: Mathieu Choplain <[email protected]>
Set the HSE clock frequency using the board's defconfig file instead of
overriding the definition.

Signed-off-by: Mathieu Choplain <[email protected]>
required to avoid CI failures due to dt_nodelabel_int_prop bug

Signed-off-by: Mathieu Choplain <[email protected]>
@mathieuchopstm
Copy link
Contributor Author

maybe better solution: make HSE node mandatory in DT but take its value even if status = "disabled";

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants